package think.thread.sychron.c02.pipe;

import java.io.IOException;
import java.io.PipedReader;

public class Receive implements Runnable {
	
	private PipedReader reader;

	public Receive(Sender sender) throws IOException {
		reader = new PipedReader(sender.getWriter());
	}

	public void run() {
		try {
			char c;
			while ((c = (char) reader.read()) != 'z') {
				System.out.println("read :" + c);
			}
			System.out.println("read :z");
			System.out.println("receive over");
		} catch (Exception e) {
			
		}
	}

}
